<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
cfc('core')->checklogin();
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
if($_RQ['op']=='get'){
	$item=pdo_get('jy_onlineedu_user',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$member=pdo_get('core_members',array('id'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),array('birth','pcd'));
	if(!$item){
		exi('找不到会员信息！','error');
	}
	if($item['province']){
		$item['pcd']=array(
			'province'=>$item['province'],
			'city'=>$item['city'],
			'district'=>$item['district'],
		);
	}else{
		$item['pcd'] = json_decode($member['pcd'],true);
	}
	if($item['birth']){
		$item['birth']=json_decode($item['birth'],true);
	}else{
		$item['birth']=array('year'=>2000,'month'=>1,'day'=>1);
	}
	if($item['pcd']){
	}else{
	   $item['pcd']=array('province'=>''); 
	}
	$return['item']=$item;
	$return['years']=array();
	for($i=1970;$i<2100;$i++){
		$return['years'][]=$i;
	}
	$return['months']=array(1,2,3,4,5,6,7,8,9,10,11,12);
	$return['days']=array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);
	$return['province']=cfc('tools')->pcd();
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$data2 = array(
			'nickname'=>$postdata['nickname'],
			'avatar'=>$postdata['avatar'],
			'description'=>$postdata['description'],
			'ewm'=>$postdata['ewm'],
			'province'=>$postdata['pcd']['province'],
			'city'=>$postdata['pcd']['city'],
			'district'=>$postdata['pcd']['district'],
			'updatetime'=>TIMESTAMP,
	);
	pdo_update('jy_onlineedu_user',$data2,array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	exi('设置成功！','','goback');
}